<%@ page pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<script type="text/javascript">
  $(function(){
    var mygrid = $("#list").jqGrid({
    	url:'role/list',
        datatype: "json",
        mtype: 'GET',
        colNames:['查看','管理'],
        colModel :[ 
        {name:'id', index:'id', width:200, formatter:viewFormater}, 
        {name:'id', index:'id', width:200, formatter:removeFormatter},         
      ],
      pager:'#pager',
      rowNum:10,
      rowList:[10,20,30],
      sortname: 'name',
      sortorder: 'desc',
      viewrecords: true,
      caption: '职务列表',
      width:'500',
      height:'300',
      jsonReader: {
  		repeatitems : false,
  		id: "0"
  	  }
    }); 
    
    function viewFormater(cellvalue,options,rowObject){
       var eid = rowObject['id'];
       var url = 'getrole.action?bean.id='+cellvalue;
       var link = $(getAjaxLink(url,rowObject['name']));
       return $("<span></span>").append(link).html();

    }
    function removeFormatter(cellvalue ,options,rowObject){
    	var url =  'removerole.action?bean.id='+cellvalue;
       	var link=$(getAjaxMsgLink(url,'删除','您确认删除!'));
    	return $("<span></span>").append(link).html();
    }  
    
       
}); 
</script>
<div id="jqgrid">
<table id="list"></table>
<div id="pager"></div>
</div>